// pages/community/community.js
//input.js
var status = true;
const { $Toast } = require('../../iview/base/index');
Page({
  data: {
    focus: false,
    status: status
  },
  longPress: function () {

    wx.makePhoneCall({

      phoneNumber: '12312345678',

    })
  },
  warnShow: function (event) {
    status = false
    this.setData({ status: status })　　　　//setData方法可以建立新的data属性，从而起到跟视图实时同步的效果
    wx.showToast({
      title: '长按进行呼叫',
      icon: 'none',
      duration: 4000
    })
  },
  // toastHide: function (event) {
  //   status = true
  //   this.setData({ status: status })
    
  // },
  
  /*touchStart: function (e) {

    var that = this;

    that.setData({

      touchStart: e.timeStamp

    })

  },
 
  touchEnd: function (e) {

    var that = this;

    that.setData({

      touchEnd: e.timeStamp

    })

  },

  pressTap: function () {

    var that = this;

    var touchTime = that.data.touchEnd - that.data.touchStart;

    if (touchTime > 1000) { //自定义长按时长，单位为ms

      wx.showModal({

        title: '警告️',

        content: '你将清空小程序本地所有缓存！',

        success: function (res) {

          if (res.confirm) {

            wx.clearStorageSync();

          }

        }

      })

     }

  },*/
  bindtapBtn: function (e) {

    console.log(e.currentTarget.dataset.text)
    var that = this;
    console.log(e.currentTarget.dataset.text)
    wx.navigateTo({

      url: '../../pages/hurt/hurt?val=' + e.currentTarget.dataset.text
    })
  },
  /*hurtBtn: function (options) {
    wx.navigateTo({
      url: '../hurt/hurt',
    })
  },*/
  input_search: function (options) {
    wx.navigateTo({
      url: '../search/search',
    })
  },
  sosBtn: function (options) {
    wx.navigateTo({
      url: '../sos/sos',
    })
  },
  policeBtn: function () {

    wx.makePhoneCall({

      phoneNumber: '110',

    })

  }, 
  aidBtn: function () {

    wx.makePhoneCall({

      phoneNumber: '120',

    })

  }
})